<?php
include_once ('head.php');

$row_edit = $DB->get_row("select * from `". DBQZ ."_user` where `uid`={$row['uid']}");
?>
<div class="container">
    <div class="layui-card">
		<div class="layui-card-header">更改账户信息</div>
		<div class="layui-card-body">
			<div class="layui-form-item">
				<div class="layui-form layui-form-pane">
					<label class="layui-form-label">账户名</label>
					<div class="layui-input-block">
						<input type="text" autocomplete="off" placeholder="" value="<?=$row_edit['user']?>" class="layui-input" disabled>
					</div>
					<hr >
					<label class="layui-form-label">新密码</label>
					<div class="layui-input-block">
						<input type="text" id="pwd" autocomplete="off" placeholder="不改留空" value="" class="layui-input">
					</div>
					<hr >
					<label class="layui-form-label">电子邮箱</label>
					<div class="layui-input-block">
						<input type="text" id="mail" autocomplete="off" placeholder="电子邮箱" value="<?=$row_edit['mail']?>" class="layui-input">
					</div>
					<hr >
					<label class="layui-form-label">QQ号码</label>
					<div class="layui-input-block">
						<input type="text" id="qq" autocomplete="off" placeholder="QQ号码" value="<?=$row_edit['qq']?>" class="layui-input">
					</div>
					
					<br>
					<button type="button" class="layui-btn layui-btn-fluid" onclick="infoedit()">更 改</button>
				</div>
			</div>
			
		</div>
	</div>
	
</div>
	<script src="../layui/layui.all.js"></script>
	<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
	<!--您的Layui代码start-->
	<script type="text/javascript">
	
		// 更改账户信息
		function infoedit(){
			var pwd 	= $('#pwd').val();
			var mail 	= $('#mail').val();
			var qq 		= $('#qq').val();
			var index 	= layer.load(1, {shade: [0.6,'#000']}); //0.1透明度的白色背景
			$.ajax({
				type: "post",   
				url:  "Ajax.php", 
				data: "my=infoedit&pwd="+pwd+"&mail="+mail+"&qq="+qq,
				dataType: "json",
				success: function (res) {
					layer.close(index);
					if(res.code==1){
						layer.msg(res.msg,{icon: 6});
						history.go(0);
					}else if(res.code==0){
						layer.msg(res.msg,{icon: 5});
					}
				},
				error: function (res) {
					layer.msg('请求失败',{icon: 5});
					layer.close(index);
				}   
			});
		}
	</script>
</body>
</html>
